package com.xbongbong.crm.handle.analysis;

import com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt;
import com.xbongbong.paas.help.FormDataHelp;
import com.xbongbong.paas.pojo.dto.FormDataListDTO;
import com.xbongbong.paas.pojo.vo.PaasFormDataEsListVO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.parent.parse.data.AbstractListAnalysisDataService;
import com.xbongbong.pro.enums.DistributorMarkEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * @author sunshaoxiang
 * /**
 * @ClassName ContactListAnalysisDataHandler
 * @Description 联系人解析数据
 * @Date 2022/5/17 11:32
 * @Version 1.0
 **/
@Component("contactListAnalysisDataHandler")
@Slf4j
public class ContactListAnalysisDataHandler extends AbstractListAnalysisDataService<PaasFormDataEntityExt> {

    @Resource
    private FormDataHelp formDataHelp;

    private static final Logger LOG = LoggerFactory.getLogger(ContactListAnalysisDataHandler.class);

    @Override
    public List<Integer> businessList() {
        return Collections.singletonList(XbbRefTypeEnum.CONTACT.getCode());
    }

    @Override
    public void analysisDataList(FormDataListDTO formDataListDTO, PaasFormDataEsListVO formDataListVO) throws XbbException {
        super.analysisDataList(formDataListDTO, formDataListVO);

        //只存数据库未存es数据处理
        formDataHelp.setOnlyDBData(formDataListDTO.getBusinessType(), DistributorMarkEnum.OTHER.getCode(), formDataListDTO.getCorpid(),
                formDataListDTO.getBusinessType(), formDataListVO.getPaasFormDataESList());
    }
}
